// createRouter:创建路由的api，createWebHashHistory：创建路由的历史模式
import { createRouter, createWebHashHistory } from 'vue-router'
// 创建一个路由
const routes = [
	{
		// 重定向页面
		path: '/',
		redirect: '/login'
	},
	{
		name: 'login',
		path: '/login',
		component: () => import('@/views/login/index.vue')
	},
	{
		name: 'menu',
		path: '/menu',
		component: () => import('@/views/menu/index.vue'),
		children: [
			{
			name: 'home',
			path: '/home',
			component: () => import('@/views/home/index.vue')
			},
			{
			name: 'set',
			path: '/set',
			component: () => import('@/views/set/index.vue')
			}
	]
	},
]

// 创建路由的实例
const router = createRouter({
	history: createWebHashHistory(),
	routes
})
// 向外暴露这个路由（默认暴露）
export default router